<?php
namespace RTSCraft\MainBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\UniqueConstraint;
use Doctrine\ORM\Mapping\OrderBy;

use Doctrine\Common\Collections\ArrayCollection;

/**
 * @ORM\Entity(repositoryClass="RTSCraft\MainBundle\Repository\ElementRepository")
 * @ORM\Table(name="Element", uniqueConstraints={@UniqueConstraint(name="name_unique", columns={"name"})})
 */
class Element
{
  /**
   * @ORM\Id
   * @ORM\Column(type="integer")
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  protected $id;

  /**
   * @ORM\Column(type="string", length="256")
   */
  protected $name;

  /**
   * @ORM\Column(type="string", length="256")
   */
  protected $imgURL;
 
  /**
   * @ORM\Column(type="boolean")
   */
  protected $deleted;

  public function __construct()
  {
    $this->article_id = new ArrayCollection();
    $this->costs =  new ArrayCollection();
    $this->costs[0] = new Costs();
    $this->costs[0]->setName("Costs");
  }
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

  /**
   * @ORM\ManyToMany(targetEntity="Costs", cascade={"persist"})
   **/
    protected $costs;

  /**
   * @ORM\ManyToMany(targetEntity="Sheets")
   **/
    protected $sheets;

  /**
   * @ORM\ManyToMany(targetEntity="Factions", cascade={"delete"})
   **/
    protected $factions;

  /**
   * @ORM\ManyToOne(targetEntity="Category")
   */
    protected $category;

  /**
   * Get costs
   *
   * @return Costs[]
   */
  public function getCosts()
  {
    return $this->costs;
  }


    /**
     * Add article_id
     *
     * @param RTSCraft\MainBundle\Entity\Article $articleId
     */
    public function addArticle(\RTSCraft\MainBundle\Entity\Article $articleId)
    {
        $this->article_id[] = $articleId;
    }

    /**
     * Add costs
     *
     * @param RTSCraft\MainBundle\Entity\Costs $costs
     */
    public function addCosts(\RTSCraft\MainBundle\Entity\Costs $costs)
    {
        $this->costs[] = $costs;
    }

    /**
     * Add factions
     *
     * @param RTSCraft\MainBundle\Entity\Factions $factions
     */
    public function addFactions(\RTSCraft\MainBundle\Entity\Factions $factions)
    {
        $this->factions[] = $factions;
    }

    /**
     * Get factions
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getFactions()
    {
        return $this->factions;
    }

    /**
     * Set category
     *
     * @param RTSCraft\MainBundle\Entity\Category $category
     */
    public function setCategory(\RTSCraft\MainBundle\Entity\Category $category)
    {
        $this->category = $category;
    }

    /**
     * Get category
     *
     * @return RTSCraft\MainBundle\Entity\Category 
     */
    public function getCategory()
    {
        return $this->category;
    }

    /**
     * Add sheets
     *
     * @param RTSCraft\MainBundle\Entity\Sheets $sheets
     */
    public function addSheets(\RTSCraft\MainBundle\Entity\Sheets $sheets)
    {
        $this->sheets[] = $sheets;
    }

    /**
     * Get sheets
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getSheets()
    {
        return $this->sheets;
    }

    /**
     * Set imgURL
     *
     * @param string $imgURL
     */
    public function setImgURL($imgURL)
    {
        $this->imgURL = $imgURL;
    }

    /**
     * Get imgURL
     *
     * @return string 
     */
    public function getImgURL()
    {
        return $this->imgURL;
    }

    /**
     * Set deleted
     *
     * @param boolean $deleted
     */
    public function setDeleted($deleted)
    {
        $this->deleted = $deleted;
    }

    /**
     * Get deleted
     *
     * @return boolean 
     */
    public function getDeleted()
    {
        return $this->deleted;
    }
}